# -*- coding: utf-8 -*-


from PyQt5.QtWidgets import *
import sys


class Qldemo(QDialog):
    def __init__(self, parent=None):
        super(Qldemo, self).__init__(parent)
        self.setWindowTitle("快捷键")
        # Alt+n
        label1 = QLabel('&name', self)
        label1_1 = QLineEdit(self)
        label1.setBuddy(label1_1)
        # Alt+p
        label2 = QLabel("&pwd", self)
        label2_2 = QLineEdit(self)
        label2.setBuddy(label2_2)
        # Alt + g
        btn1 = QPushButton("&go")
        btn1.clicked.connect(link_click)
        btn1_cancel = QPushButton("out")
        mainlayout = QGridLayout(self)
        mainlayout.addWidget(label1, 0, 0)
        # 设置排布位置
        mainlayout.addWidget(label1_1, 0, 1, 1, 2)

        mainlayout.addWidget(label2, 1, 0)
        mainlayout.addWidget(label2_2, 1, 1, 1, 2)

        mainlayout.addWidget(btn1, 2, 1)
        mainlayout.addWidget(btn1_cancel, 2, 2)


def link_click():
    print("鼠标点击label2，触发")


def link_hovere():
    print("鼠标点击label4，触发")


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ql = Qldemo()
    ql.show()
    sys.exit(app.exec_())

